use crate::fetcher::{delete, get, post, put, Callback, Fetchable, Nothing};
pub use crate::fetcher::{FetchTask, Resp};
use crate::state::Post;

const HOST: &'static str = "https://jsonplaceholder.typicode.com";

fn uri(suffix: &str) -> String {
    format!("{}/{}", HOST, suffix)
}

pub fn fetch_post(handler: Callback<Resp<Post>>) -> Option<FetchTask> {
    get(uri("posts/1")).body(Nothing).execute(handler)
}
